package com.qeebu.SMSManagerClient.util;

import java.util.HashMap;
import java.util.Map;

import com.qeebu.SMSManagerClient.smsList.ConversionSMSListActivity;

/**
 * 公用方法类
 * @author yongjun
 *
 */
public class UtilMethod
{
    /*存储联系人《号码，显示名称》*/
    private static Map<String,String> contact = new HashMap<String, String>();
    
    public static Map<String, String> getContact()
    {
        return contact;
    }

    public static void setContact(Map<String, String> contact)
    {
        UtilMethod.contact = contact;
    }

    /**
     * 已知号码获得显示名称
     * @param 号码
     * @return 显示名称
     */
    public static String getName(String num){
        int len = num.length();
        String subNum = num;
        if(len>11){
            subNum = num.substring(len-11, len);
        }
        String name = contact.get(subNum);
        if(name == null)
            return num;
        else
            return name;
    }
}
